// ----------------------------------------
// Filename: main.c
// Description: The main
// Author: Jon Maloney
// Date: 8-Jun-2012
//

//************************************************************
//                    Include .h files
//************************************************************
#include "thread.h"
#include "Scheduler.h"
#include "Serial_Testing.h"
#include <stdio.h>

//************************************************************
//                    Include external references
//************************************************************

//************************************************************
//                    Testing Define Statements
//************************************************************

#define CONTEXT_SWITCH_TEST 1	//Unit testing for the scheduler
								// specifically context switching

#define QUEUE_TEST 0

#define SERIAL_TEST 0

//************************************************************
//                    Define Statements
//************************************************************

//************************************************************
//                    Struct, Union, enum Statements
//************************************************************

//************************************************************
//                    Global variables and constants
//************************************************************

//************************************************************
//                    Prototype Private Functions
//************************************************************

void IdleTask(void * functionArgument);

//************************************************************
//                    Implementation
//************************************************************

void main(void)
{
	Thread_Create(IdleTask, NULL, 200, 0);

#if CONTEXT_SWITCH_TEST
	contextSwitchTest(1);		//When tesing this will never return
#endif

#if QUEUE_TEST
	queueTest();
#endif

#if SERIAL_TEST == 1
	Serial_Test();
#endif
	
	Scheduler_Start();

}

void IdleTask(void * functionArgument)
{

	while(1)
	{
		asm volatile("NOP");
	}

}
